<?php
include '../mgm_application.php';
$mgmApps = new mgmApps();
$mgmApps->DBconnect();

$email = $_POST['email'];

if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email)){
  $result = '2';
} else {
	$query = "SELECT COUNT(email) as countEmail FROM mgm_users WHERE email ='".$email."' ";
$result = mysql_query($query);
$row = mysql_fetch_array($result);

if ($row['countEmail'] > 0) {
	$result = '0';
} else {
	$result = '1';
}

}

echo $result;



?>